/**
 * 
 */
package travibot.model.positions;

import java.util.HashSet;
import java.util.Set;

import travibot.model.EmptyPosition;
import travibot.model.Position;
import travibot.model.Structure;


/**
 * @author Petr Macek
 *
 */
public class EmptyPositionImpl implements EmptyPosition {

    private final int id;
    
    private final Position.Type type;
    
    private Set<Structure> availableStructures = new HashSet<Structure>();
    
    
    
    public EmptyPositionImpl(int id, Type type) {

        super();
        this.id = id;
        this.type = type;
    }

    /* (non-Javadoc)
     * @see travibot.engine.Position#getId()
     */
    public int getId() {

        return id;
    }

    /* (non-Javadoc)
     * @see travibot.engine.Position#getType()
     */
    public Type getType() {

        return type;
    }

    /* (non-Javadoc)
     * @see travibot.engine.Position#isDeveloped()
     */
    public boolean isDeveloped() {

        return false;
    }

    
    /* (non-Javadoc)
     * @see travibot.model.EmptyPosition#getAvailableStructures()
     */
    public Set<Structure> getAvailableStructures() {
    
        return availableStructures;
    }
    
    public void addAvailableStructure(Structure structure){
        availableStructures.add(structure);
    }
    
    @Override
    public boolean equals(Object obj) {

        boolean ret = false;
        if (obj instanceof Position) {
            if (((Position)obj).getId() == id) {
                ret = true;
            }
        }
        return ret;
    }

    @Override
    public int hashCode() {

        return String.valueOf(id).hashCode();
    }
    
    

}
